//
//  NewAndHotFooter.swift
//  Eternity
//
//  Created by cll12_12 on 2016/12/1.
//  Copyright © 2016年 ZhengWei. All rights reserved.
//

import UIKit

class NewAndHotFooter: UICollectionReusableView {
    
    // MARK: - life cycle
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        initBaseLayout()
        layoutPageSubviews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - private method
    func initBaseLayout() {
        self.addSubview(iconImageView)
    }
    
    func layoutPageSubviews() {
        iconImageView.snp.makeConstraints { (make) in
            make.edges.equalTo(self).inset(UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0))
        }
    }
    
    func configUI() {
        _iconImageView.sd_setImage(with: URL(string: "http://image55.360doc.com/DownloadImg/2012/11/1207/28161992_3.jpg"), placeholderImage: UIImage(named: "def_375x170"))
    }
    
    // MARK: - setters and getters
    var _imageName: String?
    var imageName: String? {
        set {
            if newValue != nil {
                _iconImageView.sd_setImage(with: URL(string: newValue!), placeholderImage: UIImage(named: "def_375x170"))
            }
        } get {
            return _imageName
        }
    }
    
    var _iconImageView: UIImageView!
    var iconImageView: UIImageView {
        if _iconImageView == nil {
            _iconImageView = UIImageView()
        }
        return _iconImageView
    }
}
